﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.ZY
{
    class Class1
    {
        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {

                if (ppa.IsAtPaymentPeriod)
                {
                    double feeComp = 0;

                    for (int i = 0; i <= ppa.Period; i++)
                    {
                        double c = ppa.Fee * Math.Pow(1.036, i + 1);
                        feeComp += c;
                    }

                    da.Value = feeComp;
                    da.Description = "从第0期到" + ppa.Period + "期，每期缴费" + ppa.Fee + "复利0.036之和";
                }
                else
                {
                    double f = ppa.GetDutyTotalValue("生存保险金");

                    double p = (105 - ppa.SchemePeriodActing.SchemeActing.Scheme.Insurant.Age) / 3 * ppa.Amount * 0.2;

                    da.Value = p - f;

                    da.Description = "整个保险期生存保险金总和减已支付生存保险金之和";
                }

                
                ppa.IsCurrentFinish = true;
            }

        }
    }
}
